package com.itheima.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Slf4j
@Component//容易忽略掉这个注解
@Aspect
public class MyAspect {
    //切入点方法 （公共的切入点表达式）
    @Pointcut("execution(* com.itheima.service.*.get*(..))")
    private void pt(){

    }
    //前置通知
    @Before("pt()")
    public void before(){
        log.info("MyAspect ->before....");
    }
    //后置通知
    // )")
    public void after(){
        log.info("MyAspect ->after....");
    }
}
